package com.gitee.simons.common.utils;

import java.util.UUID;

/**
 * @author jsm
 * @date 2018/11/24
 */
public class UuidUtil {
    /**
     * 获取32位uuid
     */
    public static String get32UUID() {
        return UUID.randomUUID().toString().trim().replaceAll("-", "");
    }

    public static String sub32UUID8() {
        return sub32UUID(8);
    }

    private static String sub32UUID(int length) {
        String uuid = UUID.randomUUID().toString().trim().replaceAll("-", "");
        return uuid.substring(0, length);
    }

    public static void main(String[] args) {
        System.out.println(get32UUID());
    }
}
